//
//  DiaryCell.m
//  ErWa
//
//  Created by 李雪 on 16/3/14.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "DiaryCell.h"

@implementation DiaryCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.userImgview = [[UIImageView alloc] init];
        [self.contentView addSubview:_userImgview];
        
        self.userNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_userNameLabel];
        
        self.imgView = [[UIImageView alloc] init];
        _imgView.contentMode = UIViewContentModeScaleAspectFill;
        _imgView.clipsToBounds = YES;
        [self.contentView addSubview:_imgView];
        
        self.contentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_contentLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.userImgview.frame = CGRectMake(5, 5, self.contentView.frame.size.height / 6, self.contentView.frame.size.height / 6);
    _userImgview.layer.cornerRadius = _userImgview.frame.size.width / 2;
    _userImgview.clipsToBounds = YES;
    self.userNameLabel.frame = CGRectMake(10 + _userImgview.frame.size.width, 5, self.contentView.frame.size.width - 15 - _userImgview.frame.size.width, _userImgview.frame.size.height);
    self.contentLabel.frame = CGRectMake(5, _userImgview.frame.origin.y + _userImgview.frame.size.height + 5, self.contentView.frame.size.width - 5, self.contentView.frame.size.height / 5);
    _contentLabel.numberOfLines = 0;
    self.imgView.frame = CGRectMake(5, _contentLabel.frame.origin.y + _contentLabel.frame.size.height + 5, self.contentView.frame.size.width - 10, self.contentView.frame.size.height - 20 - self.contentView.frame.size.height / 6 - self.contentView.frame.size.height / 5);
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
